﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ClevelandFreeClinic.Models;

namespace ClevelandFreeClinic.Controllers
{
    public class HomeController : Controller
    {
        private ClevelandFreeClinicDbContext db = new ClevelandFreeClinicDbContext();

        public ActionResult Index()
        {
            ViewBag.Announcements = db.Announcements.Where(x => x.Display == true).ToList();
            ViewBag.ImageUrl = "FreeClinicCleveland.jpg";
            
            ViewBag.FrontPagePoint1 = db.FrontPageKeyPoint.Where(x => x.DisplayOrder == 1).FirstOrDefault() == null ? "" : db.FrontPageKeyPoint.Where(x => x.DisplayOrder == 1).FirstOrDefault().FrontPageKeyPointText;    // "State of the Art, Modern Facility";
            ViewBag.FrontPagePoint2 = db.FrontPageKeyPoint.Where(x => x.DisplayOrder == 2).SingleOrDefault() == null ? "" : db.FrontPageKeyPoint.Where(x => x.DisplayOrder == 2).SingleOrDefault().FrontPageKeyPointText;  //  "Professionals You Can Trust";
            ViewBag.FrontPagePoint3 = db.FrontPageKeyPoint.Where(x => x.DisplayOrder == 3).SingleOrDefault() == null ? "" : db.FrontPageKeyPoint.Where(x => x.DisplayOrder == 3).SingleOrDefault().FrontPageKeyPointText;  //  "Care for you and your family absolutely free";

            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}
